<!DOCTYPE html>
<html>
<body>
    <picture></picture>

    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script>
    if (window.testRunner)
        testRunner.overridePreference("WebKitAllowRunningInsecureContent", false);

    var t = async_test("Testing an insecure image in a <picture> element.");

    window.onload = t.step_func(function () {
        var img = document.createElement('img');

        img.addEventListener('load', t.step_func(function() {
            assert_unreached("The image should not load.");
            t.done();
        }));

        img.addEventListener('error', t.step_func(function() {
            assert_equals(0, img.naturalHeight, "Should have 0 naturalHeight");
            assert_equals(0, img.naturalWidth, "Should have 0 naturalWidth");
            t.done();
        }));

        document.querySelector('picture').appendChild(img);
        img.src = "http://example.test:8080/security/resources/compass.jpg";
    });
    </script>
</body>
</html>
